package controller;


import javax.servlet.http.HttpServletRequest;


import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import pojo.User;

import service.UserMapperService;

import util.Constants;

@Controller
public class LoginController {
	
	@Autowired
	UserMapperService usermapper;
	
	@RequestMapping(value="login",method=RequestMethod.GET)
	public String login(){
		return "login";
	}
	
	/*@RequestMapping(value="login",method=RequestMethod.POST)
	public String tologin(@RequestParam("loginCode")String loginCode,@RequestParam("password")String password){
		User  user=usermapper.getUserByLoginCodeandPassword(loginCode, password);
		if(user!=null){
			
			return "main";	
		}
		return "login";
	}*/
	
	@RequestMapping("main")
	public String main(){
		return "main";
	}

	
	
	
	@RequestMapping("loginOut")
	public String loginOut(HttpServletRequest request) {
		request.getSession().removeAttribute(Constants.USER_SESSION);
		return "redirect:login";
	}
	

}
